
//读取所有文件
import Router from 'koa-router';
import { SwaggerRouter } from 'koa-swagger-decorator'
import fs from 'fs';
//const path = require('path');

import path from 'path'

const router = new Router();

const swaggerRouter = new SwaggerRouter()

// swagger docs avaliable at http://localhost:3000/swagger-html
swaggerRouter.swagger({
  title: '一个demo系统',
  description: 'API DOC',
  version: '1.0.0',

  // [optional] default is root path.
  // if you are using koa-swagger-decorator within nested router, using this param to let swagger know your current router point

  // [optional] default is /swagger-html
  swaggerHtmlEndpoint: '/swagger-html',

  // [optional] default is /swagger-json
  swaggerJsonEndpoint: '/swagger-json',
})

// 查找对应目录下的controller类

swaggerRouter.mapDir(path.resolve(__dirname, '../controller/'))

router.use(swaggerRouter.routes());

export default router;
